package Demo;

import java.util.ArrayList;
import java.util.List;

public class Demo77 {
    public static void main(String[] args) throws Exception {
        List<Member_77> all = new ArrayList<>();
        all.add(new Member_77("saxon mo", 18));
        all.add(new Member_77("saxon mo", 28));
        all.add(new Member_77("saxon mo", 90));
        System.out.println(all);
        all.forEach(System.out::println);
        System.out.println(new Member_77("ss",18).info());
        new Thread(
                ()->{
                    System.out.println("zz");
                }
        ).start();
        Function<Member_77> f=Member_77::new;
        f.output("saxonmo",555);
        System.out.println( f.output("saxonmo",555));
    }
}

@FunctionalInterface
interface Function<P> {
    public P output(String name,int age);

}

class Member_77 {
    private String name;
    private int age;

    public Member_77(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Member_77{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof Member_77)) {
            return false;
        }
        Member_77 mem = (Member_77) obj;
        return this.name.equals(mem.name) && this.age == mem.age;


    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String info() {
        return this.age + this.name;
    }
}
interface joker {
    void fun();
    public void info(String name);
}